package cn.edu.zafu.bigdata.XuShuXin.Exp1029;
/*作业2 ： 集合*/

import cn.hutool.core.lang.Range;

import java.util.HashMap;

public class StudentGradeMangerX {
    private HashMap<String, Integer> studentGradle;
    //构造函数
    public StudentGradeMangerX() {
        /*在实例化类的时候，同时实例化HashMap*/
        studentGradle = new HashMap<>();
    }
    //添加学生
    public void addStudent(String name, int grade) {
        studentGradle.put(name, grade);
    }
    //获取成绩
    public int getGrade(String name) {
        return studentGradle.getOrDefault(name, -1);
    }
    //删除成绩
    public void removeStudent(String name ) {
        studentGradle.remove(name);
    }

}
